#include <iostream>
#include <string>

int main() {
    std::string a;
    std::cout << "Введите последовательность из скобок: ";
    std::cin >> a;

    while (a.find("()") != std::string::npos || a.find("[]") != std::string::npos ||
           a.find("{}") != std::string::npos || a.find("<>") != std::string::npos) {
        size_t pos;
        while ((pos = a.find("()")) != std::string::npos) a.erase(pos, 2);
        while ((pos = a.find("[]")) != std::string::npos) a.erase(pos, 2);
        while ((pos = a.find("{}")) != std::string::npos) a.erase(pos, 2);
        while ((pos = a.find("<>")) != std::string::npos) a.erase(pos, 2);
    }

    if (!a.empty()) {
        std::cout << "False" << std::endl;
    } else {
        std::cout << "True" << std::endl;
    }

    return 0;
}
 
